# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>

pkgname=python-socketio
pkgver=5.8.0
pkgrel=2
pkgdesc='Python implementation of the Socket.IO realtime server'
url='https://github.com/miguelgrinberg/python-socketio'
arch=('any')
license=('MIT')
depends=('python' 'python-six' 'python-engineio' 'python-bidict' 'python-msgpack')
makedepends=('python-setuptools' 'python-build' 'python-installer' 'python-wheel'
             'python-sphinx' 'python-tornado')
optdepends=('python-tornado: tornado asyncio webserver')
checkdepends=('python-pytest')
options=('!makeflags')
source=(https://github.com/miguelgrinberg/python-socketio/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('a828f3565f81435c69784321fbddac1e41f06da0e60399f1274e4d09559106800b0826c0f9b7e7b86ac0c646069370b4248c71af728bf2f3e0e029135f00dd3e')
b2sums=('a1298497de2e0658a8145b0b08fbe8951d35dbc5b6fe0c0fc2188220060d34ab8c124b9f19e89d4f582b116c917c7cfc0a4f5bdf46b7859b2674e593dfcccd6f')

build() {
  cd ${pkgbase}-${pkgver}
  python -m build --wheel --no-isolation
  make -C docs man text SPHINXBUILD=sphinx-build
}

check() {
  cd ${pkgbase}-${pkgver}
  PYTHONPATH=build/lib python setup.py test
}

package() {
  cd ${pkgbase}-${pkgver}
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 docs/_build/text/index.txt "${pkgdir}/usr/share/doc/${pkgname}/DOCUMENTATION"
  install -Dm 644 docs/_build/man/python-socketio.1 "${pkgdir}/usr/share/man/man1/${pkgname}.1"
}

# vim: ts=2 sw=2 et:
